{% extends "admin/change_form.html" %}
{% load i18n %}

{% block content %}
  <div id="content-main">
    {% block suit_form_tabs %}
      {{ block.super }}
    {% endblock %}
    {% if results %}
      <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form" class="form-horizontal" novalidate>
        {% csrf_token %}{% block form_top %}{% endblock %}
        <input type="hidden" name="host_id" value="{{ object.id }}" />
        <div class="tab-content tab-content-main">
          <table id="result_list" class="table table-striped table-bordered table-hover table-condensed table-primary">
            <thead>
            <tr>
              <th scope="col" class="action-checkbox-column">
                <div class="text">
                  <span><input type="checkbox" id="action-toggle"/></span></div>
                <div class="clear"></div>
              </th>
              {% for header in result_headers %}
                <th scope="col">
                  <div class="text"><span>{{ header|capfirst }}</span></div>
                  <div class="clear"></div>
                </th>{% endfor %}
            </tr>
            </thead>
            <tbody>
            {% for result in results %}
              {% if errors %}
                <tr>
                  <td colspan="{{ result|length }}">{{ errors }}</td>
                </tr>
              {% endif %}
              <tr>
                <td class="action-checkbox">
                  <input class="action-select" name="_selected_action" type="checkbox" value="{{ result.0 }}--{{ result.2 }}--{{ result.3 }}"/></td>
                {% for item in result %}
                  <td>{{ item }}</td>{% endfor %}</tr>
            {% endfor %}
            </tbody>
          </table>
        </div>
        {% block submit_buttons_bottom %}
          <div class="submit-row form-group">
            <div class="col-sm-2"></div>
            <div class="col-sm-10">
              <div class="btn-group btn-group-lg">
                <input type="submit" value="{% trans '添加' %}" class="default btn btn-primary" name="_save"/>
                <input type="submit" value="{% trans '返回' %}" class="btn btn-default " name="_back" onclick="javascript:history(-1);"/>
              </div>
            </div>
          </div>
        {% endblock %}
      </form>
    {% endif %}
  </div>
{% endblock %}
